#include <iostream>
using namespace std;

class Adapter{
	public:
		void fun(){
			cout<<"adapter.fun"<<endl;
		}
		~Adapter(){
			cout<<"Adapter.Des"<<endl;
		}
};

class Base{
	public:
		virtual void fun()=0;
		virtual ~Base(){
			cout<<"Base.Des"<<endl;
		}
};

class D1:public Base{
	public:
		void fun(){
			cout<<"D1.fun"<<endl;
		}
		~D1(){
			cout<<"D1.Des"<<endl;
		}
};

class D2:public Base{
	private:
		Adapter a;
	public:
		D2():a(){}
		void fun(){
			a.fun();
		}
		~D2(){
			cout<<"D2.Des"<<endl;
		}
};

int main(void){
	Base * pd=new D2();
	pd->fun();
	delete pd;
	return 0;
}
